//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.siecom.tools;

import android.os.Process;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class PackageUtil {
    public PackageUtil() {
    }

    public static String getAppPackageName() {
        int pid = Process.myPid();
        File file = new File("/proc/" + pid + "/cmdline");
        if(!file.exists()) {
            return null;
        } else {
            FileInputStream fileInputStream = null;

            try {
                fileInputStream = new FileInputStream(file);
                byte[] buffer = new byte[64];
                int len = fileInputStream.read(buffer);
                if(len <= 0) {
                    return null;
                } else {
                    int i;
                    for(i = 0; i < buffer.length && buffer[i] != 0; ++i) {
                        ;
                    }

                    String var7 = new String(buffer, 0, i);
                    return var7;
                }
            } catch (IOException var16) {
                Log.e("getAppPackageName()", "从文件读取信息是发生IO异常");
                var16.printStackTrace();
                return null;
            } finally {
                if(fileInputStream != null) {
                    try {
                        fileInputStream.close();
                    } catch (IOException var15) {
                        Log.e("getAppPackageName()", "关闭fileInputStream时发生IO异常");
                        var15.printStackTrace();
                    }
                }

            }
        }
    }
}
